<template>
  <div>
    <div class="dialog-wrap" >
      <div v-if="isShow" class="dialog-cover" @click="closeMyself"></div>
      <transition name="drop">
        <div v-if="isShow" class="dialog-content">
          <p class="dialog-close" @click="closeMyself">x</p>
          <slot>empty</slot>
        </div>
      </transition>
    </div>
  </div>
</template>

<script>
  export default {
    props: {
      isShow: {
        type: Boolean,
        default: false
      }
    },
    data () {
      return {
      }
    },
    methods: {
      closeMyself () {
        this.$emit('on-close')
      }
    }
  }
</script>

<style scoped>
  .drop-enter-active {
    transition: all 0.5s ease;
  }
  .drop-leave-active {
    transition: all .5s ease;
  }
  .drop-enter {
    transform: translateY(300px);
  }
  .drop-leave-active {
    transform: translateY(300px);
  }

  .dialog-wrap {
    width: 100%;
    height: 100%;
  }
  .dialog-cover {
    background: #000;
    opacity: .3;
    position: fixed;
    z-index: 5;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  .dialog-content {
    width: 100%;
    position: fixed;
    overflow: auto;
    background: #fff;
    bottom:0;
    left: 0;
    box-sizing: border-box;
    z-index: 10;
    padding: 5% 0 0 0;
  }
  .dialog-close {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 20px;
    height: 20px;
    text-align: center;
    cursor: pointer;
  }
  .dialog-close:hover {
    color: #4fc08d;
  }
</style>
